import React, { Component } from 'react'
import Item from './components/Item'

export default class App extends Component {
    state = {
        todos:[
            {
                id:1,
                title:'吃饭',
                isDone:true
            },
            {
                id:2,
                title:'睡觉',
                isDone:true
            },
            {
                id:3,
                title:'敲代码',
                isDone:false
            }
        ]
    }
    render() {
        let {todos} = this.state
        return (
            <div>
                <ul>
                    {todos.map(todo=>(
                        <li key={todo.id}>
                            <p>title:{todo.title}</p>
                        </li>
                    ))}
                </ul>

                {todos.map(todo=>(
                    <Item key={todo.id} todo={todo}/>
                ))}
            </div>
        )
    }
}
